<template>
    <el-dialog title="编辑" :visible.sync="dialogFormVisible" width="350px">
        <el-form :model="formData" ref="formData">
            <el-form-item label="备注" label-width="80px">
                <el-input
                    type="textarea"
                    :autosize="{ minRows: 2, maxRows: 4}"
                    v-model="formData.remarks"
                    size="mini"
                ></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button size="mini" @click="resetForm('formData')">取 消</el-button>
            <el-button
                type="primary"
                @click="edit"
                :icon="loading?'el-icon-loading':''"
                :disabled="loading?true:false"
                size="mini"
            >确 定</el-button>
        </div>
    </el-dialog>
</template>
<script>
const ERR_OK = 200;
export default {
    data() {
        return {
            dialogFormVisible: false,
            formData: {},
            loading: false
        };
    },
    methods: {
        show(item) {
            this.formData = JSON.parse(JSON.stringify(item));
            this.dialogFormVisible = true;
        },
        edit() {
            this.loading = true;
            this.$ajax({
                method: "put",
                url:
                    this.GLOBAL.fulfillmentOrderService +
                    "/fulfillmentOrder/updateFulfillmentOrder",
                data: this.formData
            }).then(res => {
                this.loading = false;
                if (res.data.code === ERR_OK) {
                    this.dialogFormVisible = false;
                    this.$emit('load')
                    this.$message.success(res.data.msg);
                } else {
                    this.$message.error(res.data.msg);
                }
            });
        },
        resetForm(formName) {
            this.dialogFormVisible = false;
        }
    }
};
</script> 
